home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 050 / windmgr2.arc / WINDMNGR.INC < prev    next >
Text File  |  1980-01-01  |  3KB  |  106 lines

  1. { (C) Jim Everingham, 1985 }
  2. Const MaxScreens=8;     { change this to however many windows you will need.}
  3.       Screen_seg=$B800;
  4.       PageVal    =$0000;
  5. type MaxStr    = String[80];
  6.      windowvals = record
  7.             fg,x1,y1,x2,y2,fattr,iattr,cattr,tattr,tt,frm,wind : integer;
  8.             txt : Maxstr;
  9.          end;
  10.      windata    = Array[1..4000] of byte;
  11. var  val    : Array[0..MaxScreens] of windowvals;
  12.      Screen    : Array[0..MaxScreens] of windata;
  13.      Page    : windata absolute Screen_Seg:Pageval;
  14.      Crt,Winpage,stack_top:Integer;
  15. Procedure Windmngr;External'Windmngr.bin';
  16. Procedure Frame(x_1,y_1,x_2,y_2,f_attr,i_attr,f_rm,_wind,c_flag,p_g:integer);External Windmngr[0];
  17. Procedure Title(t_xt:Maxstr;c_attr,t_attr,x_11,y_11,tt,p_g:integer);External Windmngr[3];
  18. Procedure Mode(md:integer);external Windmngr[6];
  19. Procedure WriteXY(t_xt:Maxstr;I_attr,x_,y_,p_g:integer);External Windmngr[9];
  20. Procedure Initialize;
  21. begin
  22.   Crt:=1;
  23.   Winpage:=0;
  24.   Stack_top:=0;
  25. end;
  26. Procedure SetWindow(Num,x1,y1,x2,y2,fattr,iattr,frm,wind:integer; txt:Maxstr; tattr,cattr,tt:integer);
  27. begin
  28.     if num<=MaxScreens then
  29.       begin
  30.      Val[num].fg:=1;
  31.      Val[num].x1:=x1;
  32.      Val[num].x2:=x2;
  33.      Val[num].y1:=y1;
  34.      Val[num].y2:=y2;
  35.      Val[num].fattr:=fattr;
  36.      Val[num].iattr:=iattr;
  37.      Val[num].frm:=frm;
  38.      Val[num].wind:=wind;
  39.      Val[num].cattr:=cattr;
  40.      Val[num].tattr:=tattr;
  41.      Val[num].tt:=tt;
  42.      Val[num].txt:=txt
  43.       end else
  44.      Writeln('Only up to ',MaxScreens,' may be defined.')
  45. end;
  46. Procedure Open(Num:integer);
  47. begin
  48.      if val[num].fg = 1 then
  49.     begin
  50.          if stack_top=0 then
  51.         begin
  52.            Mode(0);
  53.            Move(Page,Screen[stack_top],4000);
  54.            Mode(1);
  55.            Stack_top:=1
  56.         end else
  57.         begin
  58.            Mode(0);
  59.            Move(Page,Screen[Stack_top],4000);
  60.            Mode(1);
  61.            Stack_top:=Succ(Stack_top)
  62.         end;
  63.          Frame(Val[num].x1,Val[num].y1,Val[num].x2,Val[num].y2,Val[num].fattr,
  64.            Val[num].iattr,Val[num].frm,Val[num].wind,Crt,WinPage);
  65.          if val[num].txt > '' then
  66.            Title(Val[num].txt,Val[num].cattr,Val[num].tattr,Val[num].x1,
  67.            Val[num].y1,Val[num].tt,Winpage);
  68.          Window(Val[num].x1+2,Val[num].y1+2,Val[num].x2,Val[num].y2);
  69.          Gotoxy(1,1);
  70.          textbackground(Val[num].iattr div 16);
  71.          textcolor(Val[num].iattr mod 16)
  72.     end else
  73.     Writeln('Window ',num,' Not Defined.')
  74. end;
  75. Procedure Remove(Num:integer);
  76. begin
  77.   if stack_top-num >= 0 then
  78.    begin
  79.      mode(0);
  80.      move(screen[Stack_top-Num],page,4000);
  81.      mode(1);
  82.      Stack_top:=Stack_top-Num;
  83.      Window(Val[STack_top].x1+2,Val[Stack_top].y1+2,Val[Stack_top].x2,Val[Stack_top].y2);
  84.      gotoxy(1,1);
  85.      textbackground(Val[Stack_top].iattr div 16);
  86.      textcolor(Val[Stack_top].iattr mod 16);
  87.      if stack_top=0 then begin
  88.     normvideo;
  89.     window(1,1,80,25);
  90.     gotoxy(1,1)
  91.       end
  92.  end else
  93.      Write('Invalid Number, only ',stack_top,' windows active.')
  94. end;
  95. Procedure SelectWindow(Num:integer);
  96. begin
  97.      if Num>Stack_top then write('Window ',num,' not activated or defined.')
  98.      else begin
  99.     Normvideo;
  100.     Window(Val[num].x1+2,Val[num].y1+2,Val[num].x2,Val[num].y2);
  101.     Gotoxy(1,1);
  102.     textbackground(Val[num].iattr div 16);
  103.     textcolor(Val[num].iattr mod 16)
  104.      end
  105. end;
  106.